package com.ed100.sass.patter.composite;

import java.util.ArrayList;
import java.util.List;

public class MarketBranch extends Market {

	List<Market> marketList = new ArrayList<Market>();

	MarketBranch(String name) {
		this.name = name;
	}

	/**
	 * 新增
	 */
	public void add(Market m) {
		marketList.add(m);
	}

	/**
	 * 删除
	 */
	public void remove(Market m) {
		marketList.remove(m);
	}

	/**
	 * 
	 */
	public void payByCard() {
		System.out.println(name + "消费,积分已累加入该会员卡");  
		for (Market market : marketList) {
			market.payByCard();
		}
	}

}
